<template>
  <div>
    <h2>我是用户界面</h2>
    <p>{{userId}}</p>

    <button @click="btnClick">按钮</button>
  </div>
</template>

<script>
export default {
  name: "User",
  computed:{
    userId(){
      return this.$route.params.userId
    }
  },
  methods: {
    btnClick(){
      console.log("btnClick");
      this.test();
    }
  },
  //创建这个组件的时候
  created() {
    console.log("created user");
  },
  //被销毁
  destroyed() {
    console.log("destroyed user");
  }
}
</script>

<style scoped>

</style>
